home *** CD-ROM | disk | FTP | other *** search
/ Apple II Magazines (PO) / Bits and Bytes Volume 11, No. 05 (1989-11)(Apple Computing Enjoyment Society)(Side B).zip / Bits and Bytes Volume 11, No. 05 (1989-11)(Apple Computing Enjoyment Society)(Side B).po / PROGRAMS / LIFE.DOCS.txt < prev    next >
Text File  |  1996-12-24  |  8KB  |  216 lines

  1. TULiP-The Ultimate Life Program
  2.  
  3. by
  4.  
  5. Mat Hostetter
  6.  
  7.  
  8.  
  9. General Description:
  10.  
  11.      This program allows the user to design a pattern of "cells"
  12. on the screen and watch it evolve according to a set of
  13. predefined rules.  The fate of each cell depends on how many
  14. neighbors it has; some will die of loneliness, and others will
  15. die of overpopulation.  Under the right conditions, new cells are
  16. born.
  17.      While there is a nearly infinite number of sets of rules
  18. possible, only one has achieved lasting fame; the game of Life.
  19. First invented in 1968 by John Horton Conway, the game of Life
  20. has received much attention from computer scientists and
  21. biologists alike for the insight it provides.  Although Life has
  22. proven to be a useful tool, it's rules are simple.  To paraphrase
  23. Martin Gardner:
  24.  
  25. "(1) Survivals.  Every live cell with two or three
  26.      neighboring live cells survives to the next generation.
  27.  (2) Deaths.  Each cell with 4 or more neighbors dies from
  28.      overpopulation.  Every live cell with one neighbor or
  29.      none dies from isolation.
  30.  (3) Births.  Each dead cell adjacent to exactly three
  31.      live neighbors-no more,no fewer-will be alive at the
  32.      start of the next generation."
  33.  
  34. Another way of thinking about it is:
  35.  
  36.  (1) If any cell has exactly two live neighbors, it will
  37.      remain in the same state (either alive or dead.)
  38.  (2) If any cell has exactly three live neighbors, it will
  39.      come to life no matter what state it was in before.
  40.  (3) If any cell has any other number of live neighbors it
  41.      dies.
  42.  
  43.      It is important to realize that all of these changes occur
  44. simultaneously; that is, at each tick of an imaginary clock all
  45. of the cells change states instantly.
  46.  
  47. From these simple rules we get a huge number of possible
  48. patterns.  I urge you to punch in a random pattern and let it
  49. run.  Particularly interesting (for its size) is the R pentomino:
  50.  
  51.                  *
  52.                 **
  53.                  **
  54.  
  55. Of course, this pattern (and all others) will evolve exactly the
  56. same no matter which way you rotate them, except that it will
  57. evolve in a different direction.
  58.  
  59. Here's another interesting one:
  60.  
  61.  
  62.              **
  63.               **
  64.              *
  65.  
  66. This is called the "glider" and it moves over and up once every
  67. four "ticks", gliding endlessly along a diagonal path.
  68.  
  69.  
  70. Using the Program
  71.  
  72.  
  73. 1.  The Editor.  What you will now see is a low-resolution
  74. graphics screen with a red border.
  75.  
  76.  
  77. The cursor: The flashing square in the middle of the screen is
  78. the cursor.  You can move it around with the I,J,K,M keys or with
  79. the four arrow keys.
  80.  
  81. Drawing: To draw a dot, simply press the space bar.  To erase a
  82. live dot, position the cursor over the dot and press the space
  83. bar.
  84.  
  85. Help: Press "H" or "?" to view the online help screen.
  86.  
  87. Colors: To switch colors, press the first letter of the color you
  88. want to use...in other words, to draw in orange you would press
  89. "O", to draw in violet you would press "V" etc.  The five
  90. available colors are displayed at the bottom of the screen.  The
  91. <  > around a color (initially white) indicates that that color
  92. is the current drawing color.
  93.  
  94. The Effect of Colors: Whenever a new dot is formed, its color
  95. depends on the relative mix of colors that created it.  For
  96. example, if a new dot was formed from 2 white dots and 1 green
  97. dot, the new dot would be white.  If there is a tie (e.g. 1 white
  98. dot,1 green dot and 1 yellow dot) the new dot will be a gray
  99. "neutral" color.  Live dots can also change colors; if a live dot
  100. is surrounded by dots of more than one color, it will change
  101. color if some color other than its own has the majority of the
  102. cells surrounding it.  For example, if a green dot is surrounded
  103. by two yellow dots and one violet dot, it will become yellow.  If
  104. it is surrounded by one green, one yellow and one orange, it will
  105. stay green (not turn neutral.)  The only time a live dot will
  106. become neutral is if there is a tie of other colors around it and
  107. the parent color is not represented at least equally.
  108.  
  109. Evolving Your Pattern: Press return to start; if you wish to
  110. stop, press any key.  To only evolve one generation, press "E"
  111. when you are in the editor.
  112.  
  113. Blanking the Screen: Press "B" to completely erase the screen.
  114. THIS WILL WIPE OUT YOUR PATTERN!
  115.  
  116. Quitting: Press escape to quit the program.  This will most
  117. likely dump you into ProDOS (I followed Apple's protocol.)  To
  118. get back to BASIC just press return for the prefix and
  119. "BASIC.SYSTEM" for the next application.  Sorry, I have no
  120. control over this one.
  121.  
  122. Editing the Rules: Press "R" to edit the rules.  See below for
  123. detailed information.
  124.  
  125. Moving the screen: Pressing control-W, control-A, control-S or
  126. control-Z will scroll the entire screen up,left,right or down
  127. depending on which key you press.  Try it!
  128.  
  129. Disk access: press "L" to load or "S" to save.  You will be
  130. prompted for the filename.  Only letters, numbers and the "." key
  131. are allowed in filenames.  No spaces are allowed in ProDOS.
  132. Sorry, there is no inherent way to catalog from within this
  133. program.
  134.  
  135.  
  136. 3. The Rules Editor
  137.  
  138. Press "R" from the main editor to get here.  You will be
  139. confronted with a text screen that lists out what will happen to
  140. a cell if it has x neighbors.  For example, when you first get
  141. here, you will see:
  142.  
  143. 0 neighbors:dead
  144. 1 neighbor :dead
  145. 2 neighbors:stay the same
  146. 3 neighbors:alive
  147. 4 neighbors:dead
  148. 5 neighbors:dead
  149. 6 neighbors:dead
  150. 7 neighbors:dead
  151. 8 neighbors:dead
  152.  
  153. This means that if a cell has exactly four live neighbors, it
  154. will die.  To change this, hit the down arrow or return several
  155. times (or just hit "4") to position the > marker at 4 neighbors.
  156. Now you can hit the right or left arrows to flip through the
  157. three possible outcomes or press a,d or s.  Try them all; you
  158. can't hurt anything.  Try setting 4 neighbors to "alive" by
  159. pressing "a".  Now press escape to get back to the main editor
  160. and try a pattern.  It will evolve differently!
  161.      Press "R" to return to the rules editor if you aren't there
  162. already and press "T".  This changes the type of neighborhood
  163. each cell is in.  If the screen says
  164.  
  165. "Type of neighborhood:ignore diagonals"
  166.  
  167. then the program will not figure in diagonally adjacent squares
  168. when it processes each dot.  Incidentally, if you include
  169. diagonals you are using the "Moore neighborhood."  If you choose
  170. to ignore them, you are using the "von Neuman neighborhood."
  171. They each behave radically differently.
  172.  
  173. You may also try setting the "middle dot treatment" to "count
  174. center dot."  This can have interesting effects...
  175.  
  176. For an experiment, set everything to "dead" except for "1
  177. neighbor."  Now set the Type of neighborhood to "ignore
  178. diagonals" by pressing "T" (if you have to.)  Now press escape to
  179. exit back to the main editor.  Now, blank the screen and place a
  180. single dot in the center.  Press Return to run it.  Neat!  Try
  181. some multi-dot, multi-color patterns with these rules.
  182.  
  183. You will notice as you experiment that some sets of rules are too
  184. forgiving and the screen rapidly fills up with dots.  Others are
  185. too harsh and kill everything off quickly.
  186.  
  187. Any pattern that attempts to create a new dot on the border will
  188. fail to do so.  Once a pattern attempts to create a dot where no
  189. dot can ever form it is not following the "pure" rules.  If you
  190. notice your pattern evolving near the edge of the screen, you can
  191. return to the editor by pressing a key, and then use ctrl-A,
  192. ctrl-W, ctrl-S or ctrl-Z as detailed above to move the pattern
  193. away from the edge.
  194.  
  195.  
  196. Above all, experiment!  Some really weird stuff can happen.  Some
  197. would consider some of the evolving patterns a kind of "dynamic
  198. art"--be an artist!
  199.  
  200.  
  201. If you have any questions or comments, feel free to leave me a
  202. message:
  203.        AppleLink P.E.  Air Hoople
  204.        CompuServe      74736,2307
  205.  
  206. This program is shareware.  If you get a kick out of it, please
  207. send $10 to me (a-soon-to-be-starving-college-student) so I can
  208. continue to write unusual stuff (and eat,too!)
  209.  
  210.  
  211.                        Mat Hostetter
  212.                        3921 Chelmsford
  213.                        Topeka,KS  66610
  214.  
  215. Thanks!
  216.